﻿using UnityEngine;
using System.Collections;

public class MetumAbsorbObject : MonoBehaviour
{
    [HideInInspector]
    public ObjectPool<MetumAbsorbObject> SourcePool;
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (1 << collision.gameObject.layer != Physics2D.IgnoreRaycastLayer)
        {
            Rigidbody2D rgd = collision.GetComponent<Rigidbody2D>();
            if (rgd != null)
                rgd.velocity = Vector2.zero;
            gameObject.SetActive(false);
            SourcePool.RecoverObject(this); 
        }
    }
}
